﻿
// **************************************************************************
//    Class Created by Mick Doherty (Dotnetrix) Mar 2010
//    http://dotnetrix.co.uk/
//
//    ...for GlassUI (an AeroGlass UI Library)
//    http://glassui.codeplex.com/
// **************************************************************************

using System.Drawing;
using System.Windows.Forms;
using System.Windows.Forms.Design;

namespace GlassUI.Design
{
    internal class GlassFormDesigner : DocumentDesigner
    {

        private GlassForm Owner
        {
            get { return this.Control as GlassForm; }
        }

        protected override void OnPaintAdornments(System.Windows.Forms.PaintEventArgs pe)
        {
            base.OnPaintAdornments(pe);

            bool sheetGlass = (Owner.GlassMargin.Left == -1 || Owner.GlassMargin.Top == -1 || Owner.GlassMargin.Right == -1 || Owner.GlassMargin.Bottom == -1);

            Rectangle rc = Owner.ClientRectangle;
            rc.Offset(Owner.GlassMargin.Left, Owner.GlassMargin.Top);
            rc.Width -= Owner.GlassMargin.Horizontal;
            rc.Height -= Owner.GlassMargin.Vertical;

            if (!sheetGlass)
            {
                ControlPaint.DrawFocusRectangle(pe.Graphics, rc);
            }
            
        }

        public override System.ComponentModel.Design.DesignerActionListCollection ActionLists
        {
            get
            {
                return base.ActionLists;
            }
        }

    }

}
